package com.sloan.community.repository;

import com.sloan.community.po.ArticleContent;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.List;

@Repository
public interface ArticleContentRepository extends R2dbcRepository<ArticleContent, Long> {

    //    @Query("SELECT t_article.* FROM t_article WHERE t_article.id = :articleId LIMIT 1")
    Mono<ArticleContent> findByArticleId(@Param("articleId") Long articleId);

    Mono<Void> deleteByArticleId(@Param("articleId") Long articleId);

    Flux<ArticleContent> findByArticleIdIsIn(List<Long> articleIds);
}
